package com.jl.jlapp.adapter;

import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jl.jlapp.R;
import com.jl.jlapp.eneity.OrderEvaluationDetailModel;
import com.jl.jlapp.utils.CustomGridLayoutManager;

import java.util.ArrayList;
import java.util.List;

public class EvalDetailAdapter
  extends BaseQuickAdapter<OrderEvaluationDetailModel.ResultDataBean.OrderDetailsBean, BaseViewHolder>
{
  OnClickGoodsPicItemListener onClickGoodsPicItemListener;
  OrderDetailEvaluationImageAdapter orderDetailEvaluationImageAdapter;
  List<ImageView> starts;
  
  public EvalDetailAdapter(@LayoutRes int paramInt, @Nullable List<OrderEvaluationDetailModel.ResultDataBean.OrderDetailsBean> paramList)
  {
    super(paramInt, paramList);
  }
  
  protected void convert(BaseViewHolder paramBaseViewHolder, final OrderEvaluationDetailModel.ResultDataBean.OrderDetailsBean paramOrderDetailsBean)
  {
    RecyclerView localRecyclerView = (RecyclerView)paramBaseViewHolder.getView(R.id.goods_eval_img_recycler_view);
    if (paramOrderDetailsBean.getGoodsEvaluation() != null)
    {
      ImageView localImageView1 = (ImageView)paramBaseViewHolder.getView(R.id.should_evaluation_goods_img);
      Glide.with(paramBaseViewHolder.itemView.getContext()).asBitmap().apply(new RequestOptions().placeholder(R.drawable.img_noimg_xs).error(R.drawable.img_lose_xs)).load("http://117.158.178.202:8001/JLMIS/" + paramOrderDetailsBean.getGoodsCoverUrl()).into(localImageView1);
      paramBaseViewHolder.setText(R.id.edit_evaluation_content, paramOrderDetailsBean.getGoodsEvaluation().getEvaluationContent());
      localImageView1 = (ImageView)paramBaseViewHolder.getView(R.id.evaluation_star1);
      ImageView localImageView2 = (ImageView)paramBaseViewHolder.getView(R.id.evaluation_star2);
      ImageView localImageView3 = (ImageView)paramBaseViewHolder.getView(R.id.evaluation_star3);
      ImageView localImageView4 = (ImageView)paramBaseViewHolder.getView(R.id.evaluation_star4);
      ImageView localImageView5 = (ImageView)paramBaseViewHolder.getView(R.id.evaluation_star5);
      this.starts = new ArrayList();
      this.starts.add(localImageView1);
      this.starts.add(localImageView2);
      this.starts.add(localImageView3);
      this.starts.add(localImageView4);
      this.starts.add(localImageView5);
      int i = 0;
      while (i < 5)
      {
        ((ImageView)this.starts.get(i)).setImageDrawable(paramBaseViewHolder.itemView.getResources().getDrawable(R.drawable.icon_star_gray_s));
        i += 1;
      }
      i = 0;
      while (i < paramOrderDetailsBean.getGoodsEvaluation().getScore())
      {
        ((ImageView)this.starts.get(i)).setImageDrawable(paramBaseViewHolder.itemView.getResources().getDrawable(R.drawable.icon_star_yellow_s));
        i += 1;
      }
      if ((paramOrderDetailsBean.getGoodsEvaluation().getEvaluationPics() != null) && (paramOrderDetailsBean.getGoodsEvaluation().getEvaluationPics().size() > 0))
      {
        localRecyclerView.setLayoutManager(new CustomGridLayoutManager(paramBaseViewHolder.itemView.getContext(), 5, false));
        this.orderDetailEvaluationImageAdapter = new OrderDetailEvaluationImageAdapter(2131361927, paramOrderDetailsBean.getGoodsEvaluation().getEvaluationPics());
        localRecyclerView.setAdapter(this.orderDetailEvaluationImageAdapter);
        this.orderDetailEvaluationImageAdapter.setOnItemChildClickListener(new OnItemChildClickListener()
        {
          public void onItemChildClick(BaseQuickAdapter paramAnonymousBaseQuickAdapter, View paramAnonymousView, int paramAnonymousInt)
          {
            String picUrl = ((OrderEvaluationDetailModel.ResultDataBean.OrderDetailsBean.GoodsEvaluationBean.EvaluationPicsBean)paramOrderDetailsBean.getGoodsEvaluation().getEvaluationPics().get(paramAnonymousInt)).getPicUrl();
            if (EvalDetailAdapter.this.onClickGoodsPicItemListener != null) {
              EvalDetailAdapter.this.onClickGoodsPicItemListener.OnClickGoodsPicItem(picUrl);
            }
          }
        });
      }
      return;
    }
    Toast.makeText(paramBaseViewHolder.itemView.getContext(), "抱歉，数据错误。", Toast.LENGTH_SHORT).show();
  }
  
  public void setOnClickGoodsPicItemListener(OnClickGoodsPicItemListener paramOnClickGoodsPicItemListener)
  {
    this.onClickGoodsPicItemListener = paramOnClickGoodsPicItemListener;
  }
  
  public static abstract interface OnClickGoodsPicItemListener
  {
    public abstract void OnClickGoodsPicItem(String paramString);
  }
}


/* Location:              /Users/davidzhang/Documents/decompileApk/jlfood-dex2jar.jar!/com/jl/jlapp/adapter/EvalDetailAdapter.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */